home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / addport.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-12  |  1.7 KB  |  79 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: addport.c,v 1.4 1996/08/13 13:55:56 digulla Exp $
  4.     $Log: addport.c,v $
  5.     Revision 1.4  1996/08/13 13:55:56  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:02  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. #include <exec/ports.h>
  17. #include <exec/execbase.h>
  18. #include <aros/libcall.h>
  19.  
  20. /*****************************************************************************
  21.  
  22.     NAME */
  23.     #include <clib/exec_protos.h>
  24.  
  25.     __AROS_LH1(void, AddPort,
  26.  
  27. /*  SYNOPSIS */
  28.     __AROS_LHA(struct MsgPort *, port, A1),
  29.  
  30. /*  LOCATION */
  31.     struct ExecBase *, SysBase, 59, Exec)
  32.  
  33. /*  FUNCTION
  34.     Add a port to the public port list. The ln_Name and ln_Pri fields
  35.     must be initialized prior to calling this function, while
  36.     the port itself is reinitialized before adding. Therefore it's
  37.     not allowed to add an active port.
  38.  
  39.     INPUTS
  40.     port - Pointer to messageport structure.
  41.  
  42.     RESULT
  43.  
  44.     NOTES
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.  
  52.     INTERNALS
  53.  
  54.     HISTORY
  55.  
  56. ******************************************************************************/
  57. {
  58.     __AROS_FUNC_INIT
  59.  
  60.     /* Yes, this is a messageport */
  61.     port->mp_Node.ln_Type=NT_MSGPORT;
  62.  
  63.     /* Clear the list of messages */
  64.     port->mp_MsgList.lh_Head=(struct Node *)&port->mp_MsgList.lh_Tail;
  65.     port->mp_MsgList.lh_Tail=NULL;
  66.     port->mp_MsgList.lh_TailPred=(struct Node *)&port->mp_MsgList.lh_Head;
  67.  
  68.     /* Arbitrate for the list of messageports. */
  69.     Forbid();
  70.  
  71.     /* And add the actual port */
  72.     Enqueue(&SysBase->PortList,&port->mp_Node);
  73.  
  74.     /* All done */
  75.     Permit();
  76.     __AROS_FUNC_EXIT
  77. } /* AddPort */
  78.  
  79.